
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>安装与使用 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="architecture.html" />
    
    
    <link rel="prev" href="intro.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../CHANGELOG.md">
            
                <span>
            
                    
                    修订记录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../CONTRIBUTING.md">
            
                <span>
            
                    
                    如何贡献
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../introduction/">
            
                <a href="../introduction/">
            
                    
                    Docker 简介
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../introduction/what.html">
            
                <a href="../introduction/what.html">
            
                    
                    什么是 Docker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../introduction/why.html">
            
                <a href="../introduction/why.html">
            
                    
                    为什么要用 Docker
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../basic_concept/">
            
                <a href="../basic_concept/">
            
                    
                    基本概念
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../basic_concept/image.html">
            
                <a href="../basic_concept/image.html">
            
                    
                    镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../basic_concept/container.html">
            
                <a href="../basic_concept/container.html">
            
                    
                    容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="../basic_concept/repository.html">
            
                <a href="../basic_concept/repository.html">
            
                    
                    仓库
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../install/">
            
                <a href="../install/">
            
                    
                    安装 Docker
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../install/ubuntu.html">
            
                <a href="../install/ubuntu.html">
            
                    
                    Ubuntu
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../install/debian.html">
            
                <a href="../install/debian.html">
            
                    
                    Debian
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../install/fedora.html">
            
                <a href="../install/fedora.html">
            
                    
                    Fedora
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../install/centos.html">
            
                <a href="../install/centos.html">
            
                    
                    CentOS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../install/raspberry-pi.html">
            
                <a href="../install/raspberry-pi.html">
            
                    
                    Raspberry Pi
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../install/mac.html">
            
                <a href="../install/mac.html">
            
                    
                    macOS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../install/windows.html">
            
                <a href="../install/windows.html">
            
                    
                    Windows 10
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../install/mirror.html">
            
                <a href="../install/mirror.html">
            
                    
                    镜像加速器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../install/experimental.html">
            
                <a href="../install/experimental.html">
            
                    
                    开启实验特性
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../image/">
            
                <a href="../image/">
            
                    
                    使用镜像
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../image/pull.html">
            
                <a href="../image/pull.html">
            
                    
                    获取镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../image/list.html">
            
                <a href="../image/list.html">
            
                    
                    列出镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../image/rm.html">
            
                <a href="../image/rm.html">
            
                    
                    删除本地镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../image/commit.html">
            
                <a href="../image/commit.html">
            
                    
                    利用 commit 理解镜像构成
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../image/build.html">
            
                <a href="../image/build.html">
            
                    
                    使用 Dockerfile 定制镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../image/dockerfile/">
            
                <a href="../image/dockerfile/">
            
                    
                    Dockerfile 指令详解
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.6.1" data-path="../image/dockerfile/copy.html">
            
                <a href="../image/dockerfile/copy.html">
            
                    
                    COPY 复制文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.2" data-path="../image/dockerfile/add.html">
            
                <a href="../image/dockerfile/add.html">
            
                    
                    ADD 更高级的复制文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.3" data-path="../image/dockerfile/cmd.html">
            
                <a href="../image/dockerfile/cmd.html">
            
                    
                    CMD 容器启动命令
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.4" data-path="../image/dockerfile/entrypoint.html">
            
                <a href="../image/dockerfile/entrypoint.html">
            
                    
                    ENTRYPOINT 入口点
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.5" data-path="../image/dockerfile/env.html">
            
                <a href="../image/dockerfile/env.html">
            
                    
                    ENV 设置环境变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.6" data-path="../image/dockerfile/arg.html">
            
                <a href="../image/dockerfile/arg.html">
            
                    
                    ARG 构建参数
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.7" data-path="../image/dockerfile/volume.html">
            
                <a href="../image/dockerfile/volume.html">
            
                    
                    VOLUME 定义匿名卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.8" data-path="../image/dockerfile/expose.html">
            
                <a href="../image/dockerfile/expose.html">
            
                    
                    EXPOSE 暴露端口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.9" data-path="../image/dockerfile/workdir.html">
            
                <a href="../image/dockerfile/workdir.html">
            
                    
                    WORKDIR 指定工作目录
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.10" data-path="../image/dockerfile/user.html">
            
                <a href="../image/dockerfile/user.html">
            
                    
                    USER 指定当前用户
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.11" data-path="../image/dockerfile/healthcheck.html">
            
                <a href="../image/dockerfile/healthcheck.html">
            
                    
                    HEALTHCHECK 健康检查
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.12" data-path="../image/dockerfile/onbuild.html">
            
                <a href="../image/dockerfile/onbuild.html">
            
                    
                    ONBUILD 为他人作嫁衣裳
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6.13" data-path="../image/dockerfile/references.html">
            
                <a href="../image/dockerfile/references.html">
            
                    
                    参考文档
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../image/multistage-builds/">
            
                <a href="../image/multistage-builds/">
            
                    
                    Dockerfile 多阶段构建
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.7.1" data-path="../image/multistage-builds/laravel.html">
            
                <a href="../image/multistage-builds/laravel.html">
            
                    
                    实战多阶段构建 Laravel 镜像
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../image/manifest.html">
            
                <a href="../image/manifest.html">
            
                    
                    构建多种系统架构支持的 Docker 镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="../image/other.html">
            
                <a href="../image/other.html">
            
                    
                    其它制作镜像的方式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10" data-path="../image/internal.html">
            
                <a href="../image/internal.html">
            
                    
                    实现原理
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../container/">
            
                <a href="../container/">
            
                    
                    操作容器
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../container/run.html">
            
                <a href="../container/run.html">
            
                    
                    启动
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../container/daemon.html">
            
                <a href="../container/daemon.html">
            
                    
                    守护态运行
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../container/stop.html">
            
                <a href="../container/stop.html">
            
                    
                    终止
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../container/attach_exec.html">
            
                <a href="../container/attach_exec.html">
            
                    
                    进入容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.5" data-path="../container/import_export.html">
            
                <a href="../container/import_export.html">
            
                    
                    导出和导入
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.6" data-path="../container/rm.html">
            
                <a href="../container/rm.html">
            
                    
                    删除
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="../repository/">
            
                <a href="../repository/">
            
                    
                    访问仓库
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.9.1" data-path="../repository/dockerhub.html">
            
                <a href="../repository/dockerhub.html">
            
                    
                    Docker Hub
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.2" data-path="../repository/registry.html">
            
                <a href="../repository/registry.html">
            
                    
                    私有仓库
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.3" data-path="../repository/registry_auth.html">
            
                <a href="../repository/registry_auth.html">
            
                    
                    私有仓库高级配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9.4" data-path="../repository/nexus3_registry.html">
            
                <a href="../repository/nexus3_registry.html">
            
                    
                    Nexus 3
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="../data_management/">
            
                <a href="../data_management/">
            
                    
                    数据管理
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.10.1" data-path="../data_management/volume.html">
            
                <a href="../data_management/volume.html">
            
                    
                    数据卷
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10.2" data-path="../data_management/bind-mounts.html">
            
                <a href="../data_management/bind-mounts.html">
            
                    
                    挂载主机目录
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="../network/">
            
                <a href="../network/">
            
                    
                    使用网络
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.11.1" data-path="../network/port_mapping.html">
            
                <a href="../network/port_mapping.html">
            
                    
                    外部访问容器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.2" data-path="../network/linking.html">
            
                <a href="../network/linking.html">
            
                    
                    容器互联
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11.3" data-path="../network/dns.html">
            
                <a href="../network/dns.html">
            
                    
                    配置 DNS
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="../advanced_network/">
            
                <a href="../advanced_network/">
            
                    
                    高级网络配置
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.12.1" data-path="../advanced_network/quick_guide.html">
            
                <a href="../advanced_network/quick_guide.html">
            
                    
                    快速配置指南
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.2" data-path="../advanced_network/access_control.html">
            
                <a href="../advanced_network/access_control.html">
            
                    
                    容器访问控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.3" data-path="../advanced_network/port_mapping.html">
            
                <a href="../advanced_network/port_mapping.html">
            
                    
                    端口映射实现
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.4" data-path="../advanced_network/docker0.html">
            
                <a href="../advanced_network/docker0.html">
            
                    
                    配置 docker0 网桥
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.5" data-path="../advanced_network/bridge.html">
            
                <a href="../advanced_network/bridge.html">
            
                    
                    自定义网桥
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.6" data-path="../advanced_network/example.html">
            
                <a href="../advanced_network/example.html">
            
                    
                    工具和示例
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.7" data-path="../advanced_network/config_file.html">
            
                <a href="../advanced_network/config_file.html">
            
                    
                    编辑网络配置文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12.8" data-path="../advanced_network/ptp.html">
            
                <a href="../advanced_network/ptp.html">
            
                    
                    实例：创建一个点到点连接
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="../buildx/">
            
                <a href="../buildx/">
            
                    
                    Docker Buildx
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.13.1" data-path="../buildx/buildkit.html">
            
                <a href="../buildx/buildkit.html">
            
                    
                    BuildKit
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.2" data-path="../buildx/buildx.html">
            
                <a href="../buildx/buildx.html">
            
                    
                    使用 buildx 构建镜像
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13.3" data-path="../buildx/multi-arch-images.html">
            
                <a href="../buildx/multi-arch-images.html">
            
                    
                    使用 buildx 构建多种系统架构支持的 Docker 镜像
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="../compose/">
            
                <a href="../compose/">
            
                    
                    Docker Compose
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.14.1" data-path="../compose/introduction.html">
            
                <a href="../compose/introduction.html">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.2" data-path="../compose/install.html">
            
                <a href="../compose/install.html">
            
                    
                    安装与卸载
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.3" data-path="../compose/usage.html">
            
                <a href="../compose/usage.html">
            
                    
                    使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.4" data-path="../compose/commands.html">
            
                <a href="../compose/commands.html">
            
                    
                    命令说明
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.5" data-path="../compose/compose_file.html">
            
                <a href="../compose/compose_file.html">
            
                    
                    Compose 模板文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.6" data-path="../compose/django.html">
            
                <a href="../compose/django.html">
            
                    
                    实战 Django
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.7" data-path="../compose/rails.html">
            
                <a href="../compose/rails.html">
            
                    
                    实战 Rails
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.8" data-path="../compose/wordpress.html">
            
                <a href="../compose/wordpress.html">
            
                    
                    实战 WordPress
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14.9" data-path="../compose/lnmp.html">
            
                <a href="../compose/lnmp.html">
            
                    
                    实战 LNMP
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="../swarm_mode/">
            
                <a href="../swarm_mode/">
            
                    
                    Swarm mode
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.15.1" data-path="../swarm_mode/overview.html">
            
                <a href="../swarm_mode/overview.html">
            
                    
                    基本概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.2" data-path="../swarm_mode/create.html">
            
                <a href="../swarm_mode/create.html">
            
                    
                    创建 Swarm 集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.3" data-path="../swarm_mode/deploy.html">
            
                <a href="../swarm_mode/deploy.html">
            
                    
                    部署服务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.4" data-path="../swarm_mode/stack.html">
            
                <a href="../swarm_mode/stack.html">
            
                    
                    使用 compose 文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.5" data-path="../swarm_mode/secret.html">
            
                <a href="../swarm_mode/secret.html">
            
                    
                    管理密钥
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.6" data-path="../swarm_mode/config.html">
            
                <a href="../swarm_mode/config.html">
            
                    
                    管理配置信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15.7" data-path="../swarm_mode/rolling_update.html">
            
                <a href="../swarm_mode/rolling_update.html">
            
                    
                    滚动升级
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.16" data-path="../security/">
            
                <a href="../security/">
            
                    
                    安全
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.16.1" data-path="../security/kernel_ns.html">
            
                <a href="../security/kernel_ns.html">
            
                    
                    内核命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.2" data-path="../security/control_group.html">
            
                <a href="../security/control_group.html">
            
                    
                    控制组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.3" data-path="../security/daemon_sec.html">
            
                <a href="../security/daemon_sec.html">
            
                    
                    服务端防护
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.4" data-path="../security/kernel_capability.html">
            
                <a href="../security/kernel_capability.html">
            
                    
                    内核能力机制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.5" data-path="../security/other_feature.html">
            
                <a href="../security/other_feature.html">
            
                    
                    其它安全特性
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.16.6" data-path="../security/summary.html">
            
                <a href="../security/summary.html">
            
                    
                    总结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.17" data-path="../underly/">
            
                <a href="../underly/">
            
                    
                    底层实现
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.17.1" data-path="../underly/arch.html">
            
                <a href="../underly/arch.html">
            
                    
                    基本架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.2" data-path="../underly/namespace.html">
            
                <a href="../underly/namespace.html">
            
                    
                    命名空间
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.3" data-path="../underly/cgroups.html">
            
                <a href="../underly/cgroups.html">
            
                    
                    控制组
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.4" data-path="../underly/ufs.html">
            
                <a href="../underly/ufs.html">
            
                    
                    联合文件系统
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.5" data-path="../underly/container_format.html">
            
                <a href="../underly/container_format.html">
            
                    
                    容器格式
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.17.6" data-path="../underly/network.html">
            
                <a href="../underly/network.html">
            
                    
                    网络
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.18" data-path="../etcd/">
            
                <a href="../etcd/">
            
                    
                    Etcd 项目
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.18.1" data-path="../etcd/intro.html">
            
                <a href="../etcd/intro.html">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.2" data-path="../etcd/install.html">
            
                <a href="../etcd/install.html">
            
                    
                    安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.3" data-path="../etcd/cluster.html">
            
                <a href="../etcd/cluster.html">
            
                    
                    集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.18.4" data-path="../etcd/etcdctl.html">
            
                <a href="../etcd/etcdctl.html">
            
                    
                    使用 etcdctl
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.19" data-path="../coreos/">
            
                <a href="../coreos/">
            
                    
                    Fedora CoreOS
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.19.1" data-path="../coreos/intro.html">
            
                <a href="../coreos/intro.html">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.19.2" data-path="../coreos/install.html">
            
                <a href="../coreos/install.html">
            
                    
                    安装
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.20" data-path="../kubernetes/">
            
                <a href="../kubernetes/">
            
                    
                    Kubernetes - 开源容器编排引擎
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.20.1" data-path="../kubernetes/intro.html">
            
                <a href="../kubernetes/intro.html">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20.2" data-path="../kubernetes/concepts.html">
            
                <a href="../kubernetes/concepts.html">
            
                    
                    基本概念
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.20.3" data-path="../kubernetes/design.html">
            
                <a href="../kubernetes/design.html">
            
                    
                    架构设计
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.21" data-path="../kubernetes/setup/">
            
                <a href="../kubernetes/setup/">
            
                    
                    部署 Kubernetes
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.21.1" data-path="../kubernetes/setup/kubeadm.html">
            
                <a href="../kubernetes/setup/kubeadm.html">
            
                    
                    使用 kubeadm 部署 kubernetes
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21.2" data-path="../kubernetes/setup/docker-desktop.html">
            
                <a href="../kubernetes/setup/docker-desktop.html">
            
                    
                    在 Docker Desktop 使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21.3" data-path="../kubernetes/setup/systemd.html">
            
                <a href="../kubernetes/setup/systemd.html">
            
                    
                    一步步部署 kubernetes 集群
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.21.4" data-path="../kubernetes/setup/dashboard.html">
            
                <a href="../kubernetes/setup/dashboard.html">
            
                    
                    部署 Dashboard
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.22" data-path="../kubernetes/kubectl/">
            
                <a href="../kubernetes/kubectl/">
            
                    
                    Kubernetes 命令行 kubectl
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23" data-path="../cloud/">
            
                <a href="../cloud/">
            
                    
                    容器与云计算
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.23.1" data-path="../cloud/intro.html">
            
                <a href="../cloud/intro.html">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23.2" data-path="../cloud/tencentCloud.html">
            
                <a href="../cloud/tencentCloud.html">
            
                    
                    腾讯云
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23.3" data-path="../cloud/alicloud.html">
            
                <a href="../cloud/alicloud.html">
            
                    
                    阿里云
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23.4" data-path="../cloud/aws.html">
            
                <a href="../cloud/aws.html">
            
                    
                    亚马逊云
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.23.5" data-path="../cloud/summary.html">
            
                <a href="../cloud/summary.html">
            
                    
                    小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.24" data-path="../cases/os/">
            
                <a href="../cases/os/">
            
                    
                    实战案例 - 操作系统
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.24.1" data-path="../cases/os/busybox.html">
            
                <a href="../cases/os/busybox.html">
            
                    
                    Busybox
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.24.2" data-path="../cases/os/alpine.html">
            
                <a href="../cases/os/alpine.html">
            
                    
                    Alpine
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.24.3" data-path="../cases/os/debian.html">
            
                <a href="../cases/os/debian.html">
            
                    
                    Debian Ubuntu
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.24.4" data-path="../cases/os/centos.html">
            
                <a href="../cases/os/centos.html">
            
                    
                    CentOS Fedora
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.24.5" data-path="../cases/os/summary.html">
            
                <a href="../cases/os/summary.html">
            
                    
                    本章小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.25" data-path="../cases/ci/">
            
                <a href="../cases/ci/">
            
                    
                    实战案例 - CI/CD
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.25.1" data-path="../cases/ci/actions/">
            
                <a href="../cases/ci/actions/">
            
                    
                    GitHub Actions
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.25.2" data-path="../cases/ci/drone/">
            
                <a href="../cases/ci/drone/">
            
                    
                    Drone
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.25.2.1" data-path="../cases/ci/drone/install.html">
            
                <a href="../cases/ci/drone/install.html">
            
                    
                    部署 Drone
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.25.3" data-path="../cases/ci/travis/">
            
                <a href="../cases/ci/travis/">
            
                    
                    Travis CI
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.26" data-path="../IDE/">
            
                <a href="../IDE/">
            
                    
                    在 IDE 中使用 Docker
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.26.1" data-path="../IDE/vsCode.html">
            
                <a href="../IDE/vsCode.html">
            
                    
                    VS Code
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.27" data-path="../opensource/">
            
                <a href="../opensource/">
            
                    
                    Docker 开源项目
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.27.1" data-path="../opensource/linuxkit.html">
            
                <a href="../opensource/linuxkit.html">
            
                    
                    LinuxKit
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.28" data-path="../podman/">
            
                <a href="../podman/">
            
                    
                    podman - 下一代 Linux 容器工具
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29" data-path="../appendix/">
            
                <a href="../appendix/">
            
                    
                    附录
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.29.1" data-path="../appendix/faq/">
            
                <a href="../appendix/faq/">
            
                    
                    附录一：常见问题总结
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2" data-path="../appendix/repo/">
            
                <a href="../appendix/repo/">
            
                    
                    附录二：热门镜像介绍
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.29.2.1" data-path="../appendix/repo/ubuntu.html">
            
                <a href="../appendix/repo/ubuntu.html">
            
                    
                    Ubuntu
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.2" data-path="../appendix/repo/centos.html">
            
                <a href="../appendix/repo/centos.html">
            
                    
                    CentOS
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.3" data-path="../appendix/repo/nginx.html">
            
                <a href="../appendix/repo/nginx.html">
            
                    
                    Nginx
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.4" data-path="../appendix/repo/php.html">
            
                <a href="../appendix/repo/php.html">
            
                    
                    PHP
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.5" data-path="../appendix/repo/nodejs.html">
            
                <a href="../appendix/repo/nodejs.html">
            
                    
                    Node.js
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.6" data-path="../appendix/repo/mysql.html">
            
                <a href="../appendix/repo/mysql.html">
            
                    
                    MySQL
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.7" data-path="../appendix/repo/wordpress.html">
            
                <a href="../appendix/repo/wordpress.html">
            
                    
                    WordPress
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.8" data-path="../appendix/repo/mongodb.html">
            
                <a href="../appendix/repo/mongodb.html">
            
                    
                    MongoDB
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.2.9" data-path="../appendix/repo/redis.html">
            
                <a href="../appendix/repo/redis.html">
            
                    
                    Redis
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.29.3" data-path="../appendix/command/">
            
                <a href="../appendix/command/">
            
                    
                    附录三：Docker 命令查询
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.29.3.1" data-path="../appendix/command/docker.html">
            
                <a href="../appendix/command/docker.html">
            
                    
                    客户端命令 - docker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.3.2" data-path="../appendix/command/dockerd.html">
            
                <a href="../appendix/command/dockerd.html">
            
                    
                    服务端命令 - dockerd
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.29.4" data-path="../appendix/best_practices.html">
            
                <a href="../appendix/best_practices.html">
            
                    
                    附录四：Dockerfile 最佳实践
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.5" data-path="../appendix/debug.html">
            
                <a href="../appendix/debug.html">
            
                    
                    附录五：如何调试 Docker
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.29.6" data-path="../appendix/resources.html">
            
                <a href="../appendix/resources.html">
            
                    
                    附录六：资源链接
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.30" data-path="../archive/">
            
                <a href="../archive/">
            
                    
                    归档
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.30.1" data-path="./">
            
                <a href="./">
            
                    
                    Mesos - 优秀的集群资源调度平台
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.30.1.1" data-path="intro.html">
            
                <a href="intro.html">
            
                    
                    Mesos 简介
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.30.1.2" data-path="installation.html">
            
                <a href="installation.html">
            
                    
                    安装与使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.1.3" data-path="architecture.html">
            
                <a href="architecture.html">
            
                    
                    原理与架构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.1.4" data-path="configuration.html">
            
                <a href="configuration.html">
            
                    
                    Mesos 配置项解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.1.5" data-path="monitor.html">
            
                <a href="monitor.html">
            
                    
                    日志与监控
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.1.6" data-path="framework.html">
            
                <a href="framework.html">
            
                    
                    常见应用框架
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.1.7" data-path="summary.html">
            
                <a href="summary.html">
            
                    
                    本章小结
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.30.2" data-path="../machine/">
            
                <a href="../machine/">
            
                    
                    Docker Machine
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.30.2.1" data-path="../machine/install.html">
            
                <a href="../machine/install.html">
            
                    
                    安装
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.30.2.2" data-path="../machine/usage.html">
            
                <a href="../machine/usage.html">
            
                    
                    使用
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.30.3" data-path="../swarm/">
            
                <a href="../swarm/">
            
                    
                    Docker Swarm
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >安装与使用</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h2 id="mesos-&#x5B89;&#x88C5;&#x4E0E;&#x4F7F;&#x7528;">Mesos &#x5B89;&#x88C5;&#x4E0E;&#x4F7F;&#x7528;</h2>
<p>&#x4EE5; Mesos &#x7ED3;&#x5408; Marathon &#x5E94;&#x7528;&#x6846;&#x67B6;&#x4E3A;&#x4F8B;&#xFF0C;&#x6765;&#x770B;&#x4E0B;&#x5982;&#x4F55;&#x5FEB;&#x901F;&#x642D;&#x5EFA;&#x4E00;&#x5957; Mesos &#x5E73;&#x53F0;&#x3002;</p>
<p>Marathon &#x662F;&#x53EF;&#x4EE5;&#x8DDF; Mesos &#x4E00;&#x8D77;&#x534F;&#x4F5C;&#x7684;&#x4E00;&#x4E2A; framework&#xFF0C;&#x57FA;&#x4E8E; Scala &#x5B9E;&#x73B0;&#xFF0C;&#x53EF;&#x4EE5;&#x5B9E;&#x73B0;&#x4FDD;&#x6301;&#x5E94;&#x7528;&#x7684;&#x6301;&#x7EED;&#x8FD0;&#x884C;&#x3002;</p>
<p>&#x53E6;&#x5916;&#xFF0C;Mesos &#x9ED8;&#x8BA4;&#x5229;&#x7528; ZooKeeper &#x6765;&#x8FDB;&#x884C;&#x591A;&#x4E2A;&#x4E3B;&#x8282;&#x70B9;&#x4E4B;&#x95F4;&#x7684;&#x9009;&#x4E3E;&#xFF0C;&#x4EE5;&#x53CA;&#x4ECE;&#x8282;&#x70B9;&#x53D1;&#x73B0;&#x4E3B;&#x8282;&#x70B9;&#x7684;&#x8FC7;&#x7A0B;&#x3002;&#x4E00;&#x822C;&#x5728;&#x751F;&#x4EA7;&#x73AF;&#x5883;&#x4E2D;&#xFF0C;&#x9700;&#x8981;&#x542F;&#x52A8;&#x591A;&#x4E2A; Mesos master &#x670D;&#x52A1;&#xFF08;&#x63A8;&#x8350; 3 &#x6216; 5 &#x4E2A;&#xFF09;&#xFF0C;&#x5E76;&#x4E14;&#x63A8;&#x8350;&#x4F7F;&#x7528; supervisord &#x7B49;&#x8FDB;&#x7A0B;&#x7BA1;&#x7406;&#x5668;&#x6765;&#x81EA;&#x52A8;&#x4FDD;&#x6301;&#x670D;&#x52A1;&#x7684;&#x8FD0;&#x884C;&#x3002;</p>
<p>ZooKeeper &#x662F;&#x4E00;&#x4E2A;&#x5206;&#x5E03;&#x5F0F;&#x96C6;&#x7FA4;&#x4E2D;&#x4FE1;&#x606F;&#x540C;&#x6B65;&#x7684;&#x5DE5;&#x5177;&#xFF0C;&#x901A;&#x8FC7;&#x81EA;&#x52A8;&#x5728;&#x591A;&#x4E2A;&#x8282;&#x70B9;&#x4E2D;&#x9009;&#x4E3E; <code>leader</code>&#xFF0C;&#x4FDD;&#x969C;&#x591A;&#x4E2A;&#x8282;&#x70B9;&#x4E4B;&#x95F4;&#x7684;&#x67D0;&#x4E9B;&#x4FE1;&#x606F;&#x4FDD;&#x6301;&#x4E00;&#x81F4;&#x6027;&#x3002;</p>
<h3 id="&#x5B89;&#x88C5;">&#x5B89;&#x88C5;</h3>
<p>&#x5B89;&#x88C5;&#x4E3B;&#x8981;&#x9700;&#x8981; mesos&#x3001;zookeeper &#x548C; marathon &#x4E09;&#x4E2A;&#x8F6F;&#x4EF6;&#x5305;&#x3002;</p>
<p>Mesos &#x4E5F;&#x91C7;&#x7528;&#x4E86;&#x7ECF;&#x5178;&#x7684;&#x4E3B;-&#x4ECE;&#x7ED3;&#x6784;&#xFF0C;&#x4E00;&#x822C;&#x5305;&#x62EC;&#x82E5;&#x5E72;&#x4E3B;&#x8282;&#x70B9;&#x548C;&#x5927;&#x91CF;&#x4ECE;&#x8282;&#x70B9;&#x3002;&#x5176;&#x4E2D;&#xFF0C;mesos master &#x670D;&#x52A1;&#x548C; zookeeper &#x9700;&#x8981;&#x90E8;&#x7F72;&#x5230;&#x6240;&#x6709;&#x7684;&#x4E3B;&#x8282;&#x70B9;&#xFF0C;mesos slave &#x670D;&#x52A1;&#x9700;&#x8981;&#x90E8;&#x7F72;&#x5230;&#x6240;&#x6709;&#x4ECE;&#x8282;&#x70B9;&#x3002;marathon &#x53EF;&#x4EE5;&#x90E8;&#x7F72;&#x5230;&#x4E3B;&#x8282;&#x70B9;&#x3002;</p>
<p>&#x5B89;&#x88C5;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x6E90;&#x7801;&#x7F16;&#x8BD1;&#x3001;&#x8F6F;&#x4EF6;&#x6E90;&#x6216;&#x8005; Docker &#x955C;&#x50CF;&#x65B9;&#x5F0F;&#x8FDB;&#x884C;&#xFF0C;&#x4E0B;&#x9762;&#x5206;&#x522B;&#x8FDB;&#x884C;&#x4ECB;&#x7ECD;&#x3002;</p>
<h4 id="&#x6E90;&#x7801;&#x7F16;&#x8BD1;">&#x6E90;&#x7801;&#x7F16;&#x8BD1;</h4>
<p>&#x6E90;&#x7801;&#x7F16;&#x8BD1;&#x65B9;&#x5F0F;&#x53EF;&#x4EE5;&#x4FDD;&#x969C;&#x83B7;&#x53D6;&#x5230;&#x6700;&#x65B0;&#x7248;&#x672C;&#xFF0C;&#x4F46;&#x7F16;&#x8BD1;&#x8FC7;&#x7A0B;&#x6BD4;&#x8F83;&#x8D39;&#x65F6;&#x95F4;&#x3002;</p>
<p>&#x9996;&#x5148;&#xFF0C;&#x4ECE; apache.org &#x5F00;&#x6E90;&#x7F51;&#x7AD9;&#x4E0B;&#x8F7D;&#x6700;&#x65B0;&#x7684;&#x6E90;&#x7801;&#x3002;</p>
<pre><code class="lang-sh">$ git <span class="hljs-built_in">clone</span> https://git-wip-us.apache.org/repos/asf/mesos.git
</code></pre>
<p>&#x5176;&#x4E2D;&#xFF0C;&#x4E3B;&#x8981;&#x4EE3;&#x7801;&#x5728; <code>src</code> &#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x5E94;&#x7528;&#x6846;&#x67B6;&#x4EE3;&#x7801;&#x5728; <code>frameworks</code> &#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x6587;&#x6863;&#x5728; <code>docs</code> &#x76EE;&#x5F55;&#x4E0B;&#xFF0C;<code>include</code> &#x4E2D;&#x5305;&#x62EC;&#x4E86;&#x8DDF; Mesos &#x6253;&#x4EA4;&#x9053;&#x4F7F;&#x7528;&#x7684;&#x4E00;&#x4E9B; API &#x5B9A;&#x4E49;&#x5934;&#x6587;&#x4EF6;&#x3002;</p>
<p>&#x5B89;&#x88C5;&#x4F9D;&#x8D56;&#xFF0C;&#x4E3B;&#x8981;&#x5305;&#x62EC; Java &#x8FD0;&#x884C;&#x73AF;&#x5883;&#x3001;Linux &#x4E0A;&#x7684;&#x81EA;&#x52A8;&#x7F16;&#x8BD1;&#x73AF;&#x5883;&#x7B49;&#x3002;</p>
<pre><code class="lang-sh">$ sudo apt-get update
$ sudo apt-get install -y openjdk-8-jdk autoconf libtool \
build-essential python-dev python-boto libcurl4-nss-dev \
libsasl2-dev maven libapr1-dev libsvn-dev
</code></pre>
<p>&#x540E;&#x9762;&#x5C31;&#x662F;&#x5E38;&#x89C4; C++ &#x9879;&#x76EE;&#x7684;&#x65B9;&#x6CD5;&#xFF0C;configure &#x4E4B;&#x540E;&#x5229;&#x7528; Makefile &#x8FDB;&#x884C;&#x7F16;&#x8BD1;&#x548C;&#x5B89;&#x88C5;&#x3002;</p>
<pre><code class="lang-sh">$ <span class="hljs-built_in">cd</span> mesos
$ ./bootstrap
$ mkdir build
$ <span class="hljs-built_in">cd</span> build &amp;&amp; ../configure --with-network-isolator
$ make
$ make check &amp;&amp; sudo make install
</code></pre>
<h4 id="&#x8F6F;&#x4EF6;&#x6E90;&#x5B89;&#x88C5;">&#x8F6F;&#x4EF6;&#x6E90;&#x5B89;&#x88C5;</h4>
<p>&#x901A;&#x8FC7;&#x8F6F;&#x4EF6;&#x6E90;&#x65B9;&#x5F0F;&#x8FDB;&#x884C;&#x5B89;&#x88C5;&#x76F8;&#x5BF9;&#x4F1A;&#x7701;&#x65F6;&#x95F4;&#xFF0C;&#x4F46;&#x5F80;&#x5F80;&#x4E0D;&#x662F;&#x6700;&#x65B0;&#x7248;&#x672C;&#x3002;</p>
<p>&#x8FD9;&#x91CC;&#x4EE5; Ubuntu &#x7CFB;&#x7EDF;&#x4E3A;&#x4F8B;&#xFF0C;&#x9996;&#x5148;&#x6DFB;&#x52A0;&#x8F6F;&#x4EF6;&#x6E90;&#x5730;&#x5740;&#x3002;</p>
<pre><code class="lang-sh">$ sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF
$ DISTRO=$(lsb_release -is | tr <span class="hljs-string">&apos;[:upper:]&apos;</span> <span class="hljs-string">&apos;[:lower:]&apos;</span>)
$ CODENAME=$(lsb_release -cs)
$ <span class="hljs-built_in">echo</span> <span class="hljs-string">&quot;deb http://repos.mesosphere.io/<span class="hljs-variable">${DISTRO}</span> <span class="hljs-variable">${CODENAME}</span> main&quot;</span> | \
sudo tee /etc/apt/sources.list.d/mesosphere.list
</code></pre>
<p>&#x5237;&#x65B0;&#x672C;&#x5730;&#x8F6F;&#x4EF6;&#x4ED3;&#x5E93;&#x4FE1;&#x606F;&#x5E76;&#x5B89;&#x88C5; zookeeper&#x3001;mesos&#x3001;marathon &#x4E09;&#x4E2A;&#x8F6F;&#x4EF6;&#x5305;&#x3002;</p>
<pre><code class="lang-sh">$ sudo apt-get -y update &amp;&amp; sudo apt-get -y install zookeeper mesos marathon
</code></pre>
<p>&#x6CE8;&#x610F;&#xFF0C;Marathon &#x6700;&#x65B0;&#x7248;&#x672C;&#x9700;&#x8981; jdk 1.8+ &#x7684;&#x652F;&#x6301;&#x3002;&#x5982;&#x679C;&#x7CFB;&#x7EDF;&#x4E2D;&#x6709;&#x591A;&#x4E2A; Java &#x7248;&#x672C;&#xFF0C;&#x9700;&#x8981;&#x68C0;&#x67E5;&#x914D;&#x7F6E;&#x9ED8;&#x8BA4;&#x7684; JDK &#x7248;&#x672C;&#x7B26;&#x5408;&#x8981;&#x6C42;&#x3002;</p>
<pre><code class="lang-sh">$ sudo update-alternatives --config java
</code></pre>
<p>&#x5B89;&#x88C5; Mesos &#x6210;&#x529F;&#x540E;&#xFF0C;&#x4F1A;&#x5728; <code>/usr/sbin/</code> &#x4E0B;&#x9762;&#x53D1;&#x73B0; <code>mesos-master</code> &#x548C; <code>mesos-slave</code> &#x4E24;&#x4E2A;&#x4E8C;&#x8FDB;&#x5236;&#x6587;&#x4EF6;&#xFF0C;&#x5206;&#x522B;&#x5BF9;&#x5E94;&#x4E3B;&#x8282;&#x70B9;&#x4E0A;&#x9700;&#x8981;&#x8FD0;&#x884C;&#x7684;&#x7BA1;&#x7406;&#x670D;&#x52A1;&#x548C;&#x4ECE;&#x8282;&#x70B9;&#x4E0A;&#x9700;&#x8981;&#x8FD0;&#x884C;&#x7684;&#x4EFB;&#x52A1;&#x670D;&#x52A1;&#x3002;</p>
<p>&#x7528;&#x6237;&#x53EF;&#x4EE5;&#x624B;&#x52A8;&#x8FD0;&#x884C;&#x4E8C;&#x8FDB;&#x5236;&#x6587;&#x4EF6;&#x542F;&#x52A8;&#x670D;&#x52A1;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x901A;&#x8FC7; <code>service</code> &#x547D;&#x4EE4;&#x6765;&#x65B9;&#x4FBF;&#x8FDB;&#x884C;&#x7BA1;&#x7406;&#x3002;</p>
<p>&#x4F8B;&#x5982;&#xFF0C;&#x5728;&#x4E3B;&#x8282;&#x70B9;&#x4E0A;&#x91CD;&#x542F; Mesos &#x7BA1;&#x7406;&#x670D;&#x52A1;&#xFF1A;</p>
<pre><code class="lang-sh">$ sudo service mesos-master restart
</code></pre>
<p>&#x901A;&#x8FC7; <code>service</code> &#x547D;&#x4EE4;&#x6765;&#x7BA1;&#x7406;&#xFF0C;&#x5B9E;&#x9645;&#x4E0A;&#x662F;&#x901A;&#x8FC7;&#x8C03;&#x7528; <code>/usr/bin/mesos-init-wrapper</code> &#x811A;&#x672C;&#x6587;&#x4EF6;&#x8FDB;&#x884C;&#x5904;&#x7406;&#x3002;</p>
<h4 id="&#x57FA;&#x4E8E;-docker"><a href="https://github.com/sekka1/mesosphere-docker" target="_blank">&#x57FA;&#x4E8E; Docker</a></h4>
<p>&#x9700;&#x8981;&#x5982;&#x4E0B;&#x4E09;&#x4E2A;&#x955C;&#x50CF;&#x3002;</p>
<ul>
<li>ZooKeeper&#xFF1A;<a href="https://registry.hub.docker.com/u/garland/zookeeper/" target="_blank">https://registry.hub.docker.com/u/garland/zookeeper/</a></li>
<li>Mesos&#xFF1A;<a href="https://registry.hub.docker.com/u/garland/mesosphere-docker-mesos-master/" target="_blank">https://registry.hub.docker.com/u/garland/mesosphere-docker-mesos-master/</a></li>
<li>Marathon&#xFF1A;<a href="https://registry.hub.docker.com/u/garland/mesosphere-docker-marathon/" target="_blank">https://registry.hub.docker.com/u/garland/mesosphere-docker-marathon/</a></li>
</ul>
<p>&#x5176;&#x4E2D; mesos-master &#x955C;&#x50CF;&#x5728;&#x540E;&#x9762;&#x5C06;&#x5206;&#x522B;&#x4F5C;&#x4E3A; master &#x548C; slave &#x89D2;&#x8272;&#x8FDB;&#x884C;&#x4F7F;&#x7528;&#x3002;</p>
<p>&#x9996;&#x5148;&#xFF0C;&#x62C9;&#x53D6;&#x4E09;&#x4E2A;&#x955C;&#x50CF;&#x3002;</p>
<pre><code class="lang-sh">$ docker pull garland/zookeeper
$ docker pull garland/mesosphere-docker-mesos-master
$ docker pull garland/mesosphere-docker-marathon
</code></pre>
<p>&#x5BFC;&#x51FA;&#x4E3B;&#x8282;&#x70B9;&#x673A;&#x5668;&#x7684;&#x5730;&#x5740;&#x5230;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x3002;</p>
<pre><code class="lang-sh">$ HOST_IP=10.0.0.2
</code></pre>
<p>&#x5728;&#x4E3B;&#x8282;&#x70B9;&#x4E0A;&#x542F;&#x52A8; Zookeepr &#x5BB9;&#x5668;&#x3002;</p>
<pre><code class="lang-sh">docker run <span class="hljs-_">-d</span> \
-p 2181:2181 \
-p 2888:2888 \
-p 3888:3888 \
garland/zookeeper
</code></pre>
<p>&#x5728;&#x4E3B;&#x8282;&#x70B9;&#x4E0A;&#x542F;&#x52A8; Mesos Master &#x670D;&#x52A1;&#x5BB9;&#x5668;&#x3002;</p>
<pre><code class="lang-sh">docker run --net=<span class="hljs-string">&quot;host&quot;</span> \
-p 5050:5050 \
<span class="hljs-_">-e</span> <span class="hljs-string">&quot;MESOS_HOSTNAME=<span class="hljs-variable">${HOST_IP}</span>&quot;</span> \
<span class="hljs-_">-e</span> <span class="hljs-string">&quot;MESOS_IP=<span class="hljs-variable">${HOST_IP}</span>&quot;</span> \
<span class="hljs-_">-e</span> <span class="hljs-string">&quot;MESOS_ZK=zk://<span class="hljs-variable">${HOST_IP}</span>:2181/mesos&quot;</span> \
<span class="hljs-_">-e</span> <span class="hljs-string">&quot;MESOS_PORT=5050&quot;</span> \
<span class="hljs-_">-e</span> <span class="hljs-string">&quot;MESOS_LOG_DIR=/var/log/mesos&quot;</span> \
<span class="hljs-_">-e</span> <span class="hljs-string">&quot;MESOS_QUORUM=1&quot;</span> \
<span class="hljs-_">-e</span> <span class="hljs-string">&quot;MESOS_REGISTRY=in_memory&quot;</span> \
<span class="hljs-_">-e</span> <span class="hljs-string">&quot;MESOS_WORK_DIR=/var/lib/mesos&quot;</span> \
<span class="hljs-_">-d</span> \
garland/mesosphere-docker-mesos-master
</code></pre>
<p>&#x5728;&#x4E3B;&#x8282;&#x70B9;&#x4E0A;&#x542F;&#x52A8; Marathon&#x3002;</p>
<pre><code class="lang-sh">docker run \
<span class="hljs-_">-d</span> \
-p 8080:8080 \
garland/mesosphere-docker-marathon --master zk://<span class="hljs-variable">${HOST_IP}</span>:2181/mesos --zk zk://<span class="hljs-variable">${HOST_IP}</span>:2181/marathon
</code></pre>
<p>&#x5728;&#x4ECE;&#x8282;&#x70B9;&#x4E0A;&#x542F;&#x52A8; Mesos slave &#x5BB9;&#x5668;&#x3002;</p>
<pre><code class="lang-sh">docker run <span class="hljs-_">-d</span> \
--name mesos_slave_1 \
--entrypoint=<span class="hljs-string">&quot;mesos-slave&quot;</span> \
<span class="hljs-_">-e</span> <span class="hljs-string">&quot;MESOS_MASTER=zk://<span class="hljs-variable">${HOST_IP}</span>:2181/mesos&quot;</span> \
<span class="hljs-_">-e</span> <span class="hljs-string">&quot;MESOS_LOG_DIR=/var/log/mesos&quot;</span> \
<span class="hljs-_">-e</span> <span class="hljs-string">&quot;MESOS_LOGGING_LEVEL=INFO&quot;</span> \
garland/mesosphere-docker-mesos-master:latest
</code></pre>
<p>&#x63A5;&#x4E0B;&#x6765;&#xFF0C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x8BBF;&#x95EE;&#x672C;&#x5730; 8080 &#x7AEF;&#x53E3;&#x6765;&#x4F7F;&#x7528; Marathon &#x542F;&#x52A8;&#x4EFB;&#x52A1;&#x4E86;&#x3002;</p>
<h3 id="&#x914D;&#x7F6E;&#x8BF4;&#x660E;">&#x914D;&#x7F6E;&#x8BF4;&#x660E;</h3>
<p>&#x4E0B;&#x9762;&#x4EE5;&#x672C;&#x5730;&#x901A;&#x8FC7;&#x8F6F;&#x4EF6;&#x6E90;&#x65B9;&#x5F0F;&#x5B89;&#x88C5;&#x4E3A;&#x4F8B;&#xFF0C;&#x89E3;&#x91CA;&#x5982;&#x4F55;&#x4FEE;&#x6539;&#x5404;&#x4E2A;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x3002;</p>
<h4 id="zookeepr">ZooKeepr</h4>
<p>ZooKeepr &#x662F;&#x4E00;&#x4E2A;&#x5206;&#x5E03;&#x5F0F;&#x5E94;&#x7528;&#x7684;&#x534F;&#x8C03;&#x5DE5;&#x5177;&#xFF0C;&#x7528;&#x6765;&#x7BA1;&#x7406;&#x591A;&#x4E2A;&#x4E3B;&#x8282;&#x70B9;&#x7684;&#x9009;&#x4E3E;&#x548C;&#x5197;&#x4F59;&#xFF0C;&#x76D1;&#x542C;&#x5728; 2181 &#x7AEF;&#x53E3;&#x3002;&#x63A8;&#x8350;&#x81F3;&#x5C11;&#x5E03;&#x7F6E;&#x4E09;&#x4E2A;&#x4E3B;&#x8282;&#x70B9;&#x6765;&#x88AB; ZooKeeper &#x7EF4;&#x62A4;&#x3002;</p>
<p>&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x9ED8;&#x8BA4;&#x90FD;&#x5728; <code>/etc/zookeeper/conf/</code> &#x76EE;&#x5F55;&#x4E0B;&#x3002;&#x6BD4;&#x8F83;&#x5173;&#x952E;&#x7684;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x6709;&#x4E24;&#x4E2A;&#xFF1A;<code>myid</code> &#x548C; <code>zoo.cfg</code>&#x3002;</p>
<p>myid &#x6587;&#x4EF6;&#x4F1A;&#x8BB0;&#x5F55;&#x52A0;&#x5165; ZooKeeper &#x96C6;&#x7FA4;&#x7684;&#x8282;&#x70B9;&#x7684;&#x5E8F;&#x53F7;&#xFF08;1-255&#x4E4B;&#x95F4;&#xFF09;&#x3002;<code>/var/lib/zookeeper/myid</code> &#x6587;&#x4EF6;&#x5176;&#x5B9E;&#x4E5F;&#x662F;&#x8F6F;&#x8FDE;&#x63A5;&#x5230;&#x4E86;&#x8BE5;&#x6587;&#x4EF6;&#x3002;</p>
<p>&#x6BD4;&#x5982;&#x914D;&#x7F6E;&#x67D0;&#x8282;&#x70B9;&#x5E8F;&#x53F7;&#x4E3A; 1&#xFF0C;&#x5219;&#x9700;&#x8981;&#x5728;&#x8BE5;&#x8282;&#x70B9;&#x4E0A;&#x6267;&#x884C;&#xFF1A;</p>
<pre><code class="lang-sh">$ <span class="hljs-built_in">echo</span> 1 | sudo dd of=/etc/zookeeper/conf/myid
</code></pre>
<p>&#x8282;&#x70B9;&#x5E8F;&#x53F7;&#x5728; ZooKeeper &#x96C6;&#x7FA4;&#x4E2D;&#x5FC5;&#x987B;&#x552F;&#x4E00;&#xFF0C;&#x4E0D;&#x80FD;&#x51FA;&#x73B0;&#x591A;&#x4E2A;&#x62E5;&#x6709;&#x76F8;&#x540C;&#x5E8F;&#x53F7;&#x7684;&#x8282;&#x70B9;&#x3002;</p>
<p>&#x53E6;&#x5916;&#xFF0C;&#x9700;&#x8981;&#x4FEE;&#x6539; zoo.cfg &#x6587;&#x4EF6;&#xFF0C;&#x8BE5;&#x6587;&#x4EF6;&#x662F;&#x4E3B;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#xFF0C;&#x4E3B;&#x8981;&#x9700;&#x8981;&#x6DFB;&#x52A0;&#x4E0A;&#x52A0;&#x5165; ZooKeeper &#x96C6;&#x7FA4;&#x7684;&#x673A;&#x5668;&#x7684;&#x5E8F;&#x53F7;&#x548C;&#x5BF9;&#x5E94;&#x76D1;&#x542C;&#x5730;&#x5740;&#x3002;</p>
<p>&#x4F8B;&#x5982;&#xFF0C;&#x73B0;&#x5728; ZooKeeper &#x96C6;&#x7FA4;&#x4E2D;&#x6709;&#x4E09;&#x4E2A;&#x8282;&#x70B9;&#xFF0C;&#x5730;&#x5740;&#x5206;&#x522B;&#x4E3A; <code>10.0.0.2</code>&#x3001;<code>10.0.0.3</code>&#x3001;<code>10.0.0.4</code>&#xFF0C;&#x5E8F;&#x53F7;&#x5206;&#x522B;&#x914D;&#x7F6E;&#x4E3A; <code>2</code>&#x3001;<code>3</code>&#x3001;<code>4</code>&#x3002;</p>
<p>&#x5219;&#x914D;&#x7F6E;&#x5982;&#x4E0B;&#x7684;&#x4E09;&#x884C;&#xFF1A;</p>
<pre><code class="lang-sh">server.2=10.0.0.2:2888:3888
server.3=10.0.0.3:2888:3888
server.4=10.0.0.4:2888:3888
</code></pre>
<p>&#x5176;&#x4E2D;&#x7B2C;&#x4E00;&#x4E2A;&#x7AEF;&#x53E3; 2888 &#x8D1F;&#x8D23;&#x4ECE;&#x8282;&#x70B9;&#x8FDE;&#x63A5;&#x5230;&#x4E3B;&#x8282;&#x70B9;&#x7684;&#xFF1B;&#x7B2C;&#x4E8C;&#x4E2A;&#x7AEF;&#x53E3; 3888 &#x5219;&#x8D1F;&#x8D23;&#x4E3B;&#x8282;&#x70B9;&#x8FDB;&#x884C;&#x9009;&#x4E3E;&#x65F6;&#x5019;&#x901A;&#x4FE1;&#x3002;</p>
<p>&#x4E5F;&#x53EF;&#x4EE5;&#x7528;&#x4E3B;&#x673A;&#x540D;&#x5F62;&#x5F0F;&#xFF0C;&#x5219;&#x9700;&#x8981;&#x5404;&#x4E2A;&#x8282;&#x70B9; <code>/etc/hosts</code> &#x6587;&#x4EF6;&#x4E2D;&#x90FD;&#x8BB0;&#x5F55;&#x5730;&#x5740;&#x5230;&#x4E3B;&#x673A;&#x540D;&#x5BF9;&#x5E94;&#x7684;&#x6620;&#x5C04;&#x5173;&#x7CFB;&#x3002;</p>
<p>&#x5B8C;&#x6210;&#x914D;&#x7F6E;&#x540E;&#xFF0C;&#x542F;&#x52A8; ZooKeeper &#x670D;&#x52A1;&#x3002;</p>
<pre><code class="lang-sh">$ sudo service zookeeper start
</code></pre>
<h4 id="mesos">Mesos</h4>
<p>Mesos &#x7684;&#x9ED8;&#x8BA4;&#x914D;&#x7F6E;&#x76EE;&#x5F55;&#x6709;&#x4E09;&#x4E2A;&#xFF1A;</p>
<ul>
<li>/etc/mesos/&#xFF1A;&#x4E3B;&#x8282;&#x70B9;&#x548C;&#x4ECE;&#x8282;&#x70B9;&#x90FD;&#x4F1A;&#x8BFB;&#x53D6;&#x7684;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#xFF0C;&#x6700;&#x5173;&#x952E;&#x7684;&#x662F; zk &#x6587;&#x4EF6;&#x5B58;&#x653E;&#x4E3B;&#x8282;&#x70B9;&#x7684;&#x4FE1;&#x606F;&#xFF1B;</li>
<li>/etc/mesos-master/&#xFF1A;&#x53EA;&#x6709;&#x4E3B;&#x8282;&#x70B9;&#x4F1A;&#x8BFB;&#x53D6;&#x7684;&#x914D;&#x7F6E;&#xFF0C;&#x7B49;&#x4EF7;&#x4E8E;&#x542F;&#x52A8; mesos-master &#x547D;&#x4EE4;&#x65F6;&#x5019;&#x7684;&#x9ED8;&#x8BA4;&#x9009;&#x9879;&#xFF1B;</li>
<li>/etc/mesos-slave/&#xFF1A;&#x53EA;&#x6709;&#x4ECE;&#x8282;&#x70B9;&#x4F1A;&#x8BFB;&#x53D6;&#x7684;&#x914D;&#x7F6E;&#xFF0C;&#x7B49;&#x4EF7;&#x4E8E;&#x542F;&#x52A8; mesos-master &#x547D;&#x4EE4;&#x65F6;&#x5019;&#x7684;&#x9ED8;&#x8BA4;&#x9009;&#x9879;&#x3002;</li>
</ul>
<p>&#x6700;&#x5173;&#x952E;&#x7684;&#x662F;&#x9700;&#x8981;&#x5728;&#x6240;&#x6709;&#x8282;&#x70B9;&#x4E0A;&#x4FEE;&#x6539; <code>/etc/mesos/zk</code>&#xFF0C;&#x5199;&#x5165;&#x4E3B;&#x8282;&#x70B9;&#x96C6;&#x7FA4;&#x7684; ZooKeeper &#x5730;&#x5740;&#x5217;&#x8868;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A;</p>
<pre><code class="lang-sh">zk://10.0.0.2:2181,10.0.0.3:2181,10.0.0.4:2181/mesos
</code></pre>
<p>&#x6B64;&#x5916;&#xFF0C;<code>/etc/default/mesos</code>&#x3001;<code>/etc/default/mesos-master</code>&#x3001;<code>/etc/default/mesos-slave</code> &#x8FD9;&#x4E09;&#x4E2A;&#x6587;&#x4EF6;&#x4E2D;&#x53EF;&#x4EE5;&#x5B58;&#x653E;&#x4E00;&#x4E9B;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x5B9A;&#x4E49;&#xFF0C;Mesos &#x670D;&#x52A1;&#x542F;&#x52A8;&#x4E4B;&#x524D;&#xFF0C;&#x4F1A;&#x5C06;&#x8FD9;&#x4E9B;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x5BFC;&#x5165;&#x8FDB;&#x6765;&#x4F5C;&#x4E3A;&#x542F;&#x52A8;&#x53C2;&#x6570;&#x3002;&#x683C;&#x5F0F;&#x4E3A; <code>MESOS_OPTION_NAME</code>&#x3002;</p>
<p>&#x4E0B;&#x9762;&#x5206;&#x522B;&#x8BF4;&#x660E;&#x5728;&#x4E3B;&#x8282;&#x70B9;&#x548C;&#x4ECE;&#x8282;&#x70B9;&#x4E0A;&#x7684;&#x914D;&#x7F6E;&#x3002;</p>
<h5 id="&#x4E3B;&#x8282;&#x70B9;">&#x4E3B;&#x8282;&#x70B9;</h5>
<p>&#x4E00;&#x822C;&#x53EA;&#x9700;&#x8981;&#x5173;&#x6CE8; <code>/etc/mesos-master/</code> &#x76EE;&#x5F55;&#x4E0B;&#x7684;&#x6587;&#x4EF6;&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x76EE;&#x5F55;&#x4E0B;&#x4E3A;&#x7A7A;&#x3002;</p>
<p>&#x8BE5;&#x76EE;&#x5F55;&#x4E0B;&#x6587;&#x4EF6;&#x547D;&#x540D;&#x548C;&#x5185;&#x5BB9;&#x9700;&#x8981;&#x8DDF; mesos-master &#x652F;&#x6301;&#x7684;&#x547D;&#x4EE4;&#x884C;&#x9009;&#x9879;&#x4E00;&#x4E00;&#x5BF9;&#x5E94;&#x3002;&#x53EF;&#x4EE5;&#x901A;&#x8FC7; <code>mesos-master --help</code> &#x547D;&#x4EE4;&#x67E5;&#x770B;&#x652F;&#x6301;&#x7684;&#x9009;&#x9879;&#x3002;</p>
<p>&#x4F8B;&#x5982;&#x67D0;&#x4E2A;&#x6587;&#x4EF6; <code>key</code> &#x4E2D;&#x5185;&#x5BB9;&#x4E3A; <code>value</code>&#xFF0C;&#x5219;&#x5728; mesos-master &#x670D;&#x52A1;&#x542F;&#x52A8;&#x7684;&#x65F6;&#x5019;&#xFF0C;&#x4F1A;&#x81EA;&#x52A8;&#x6DFB;&#x52A0;&#x53C2;&#x6570; <code>--key=value</code> &#x7ED9;&#x4E8C;&#x8FDB;&#x5236;&#x547D;&#x4EE4;&#x3002;</p>
<p>&#x4F8B;&#x5982;&#xFF0C;mesos-master &#x670D;&#x52A1;&#x9ED8;&#x8BA4;&#x76D1;&#x542C;&#x5728; loopback &#x7AEF;&#x53E3;&#xFF0C;&#x5373; <code>127.0.0.1:5050</code>&#xFF0C;&#x6211;&#x4EEC;&#x9700;&#x8981;&#x4FEE;&#x6539;&#x4E3B;&#x8282;&#x70B9;&#x76D1;&#x542C;&#x7684;&#x5730;&#x5740;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x521B;&#x5EFA; /etc/mesos-master/ip &#x6587;&#x4EF6;&#xFF0C;&#x5728;&#x5176;&#x4E2D;&#x5199;&#x5165;&#x4E3B;&#x8282;&#x70B9;&#x76D1;&#x542C;&#x7684;&#x5916;&#x90E8;&#x5730;&#x5740;&#x3002;</p>
<p>&#x4E3A;&#x4E86;&#x6B63;&#x5E38;&#x542F;&#x52A8; mesos-master &#x670D;&#x52A1;&#xFF0C;&#x8FD8;&#x9700;&#x8981;&#x6307;&#x5B9A; <code>work_dir</code> &#x53C2;&#x6570;(&#x8868;&#x793A;&#x5E94;&#x7528;&#x6846;&#x67B6;&#x7684;&#x5DE5;&#x4F5C;&#x76EE;&#x5F55;)&#x7684;&#x503C;&#xFF0C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x521B;&#x5EFA; /etc/mesos-master/work_dir &#x6587;&#x4EF6;&#xFF0C;&#x5728;&#x5176;&#x4E2D;&#x5199;&#x5165;&#x76EE;&#x5F55;&#xFF0C;&#x4F8B;&#x5982; <code>/var/lib/mesos</code>&#x3002;&#x5DE5;&#x4F5C;&#x76EE;&#x5F55;&#x4E0B;&#x4F1A;&#x751F;&#x6210;&#x4E00;&#x4E2A; <code>replicated_log</code> &#x76EE;&#x5F55;&#xFF0C;&#x4F1A;&#x5B58;&#x6709;&#x5404;&#x79CD;&#x540C;&#x6B65;&#x72B6;&#x6001;&#x7684;&#x6301;&#x4E45;&#x5316;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x4EE5;&#x53CA;&#x6307;&#x5B9A; quorum &#x53C2;&#x6570;&#x7684;&#x503C;&#xFF0C;&#x8BE5;&#x53C2;&#x6570;&#x7528;&#x6765;&#x8868;&#x793A; ZooKeeper &#x96C6;&#x7FA4;&#x4E2D;&#x8981;&#x6C42;&#x6700;&#x5C11;&#x53C2;&#x52A0;&#x8868;&#x51B3;&#x7684;&#x8282;&#x70B9;&#x6570;&#x76EE;&#x3002;&#x4E00;&#x822C;&#x8BBE;&#x7F6E;&#x4E3A;&#x6BD4; ZooKeeper &#x96C6;&#x7FA4;&#x4E2D;&#x8282;&#x70B9;&#x4E2A;&#x6570;&#x7684;&#x534A;&#x6570;&#x591A;&#x4E00;&#x4E9B;&#xFF08;&#x6BD4;&#x5982;&#x4E09;&#x4E2A;&#x8282;&#x70B9;&#x7684;&#x8BDD;&#xFF0C;&#x53EF;&#x4EE5;&#x914D;&#x7F6E;&#x4E3A; <code>2</code>&#xFF09;&#x3002;</p>
<p>&#x6B64;&#x5916;&#xFF0C;&#x8981;&#x4FEE;&#x6539; Mesos &#x96C6;&#x7FA4;&#x7684;&#x540D;&#x79F0;&#xFF0C;&#x53EF;&#x4EE5;&#x521B;&#x5EFA; <code>/etc/mesos-master/cluster</code> &#x6587;&#x4EF6;&#xFF0C;&#x5728;&#x5176;&#x4E2D;&#x5199;&#x5165;&#x96C6;&#x7FA4;&#x7684;&#x522B;&#x540D;&#xFF0C;&#x4F8B;&#x5982; <code>MesosCluster</code>&#x3002;</p>
<p>&#x603B;&#x7ED3;&#x4E0B;&#xFF0C;&#x5EFA;&#x8BAE;&#x5728; <code>/etc/mesos-master</code> &#x76EE;&#x5F55;&#x4E0B;&#xFF0C;&#x914D;&#x7F6E;&#x81F3;&#x5C11;&#x56DB;&#x4E2A;&#x53C2;&#x6570;&#x6587;&#x4EF6;&#xFF1A;<code>ip</code>&#x3001;<code>quorum</code>&#x3001;<code>work_dir</code>&#x3001;<code>cluster</code>&#x3002;</p>
<p>&#x4FEE;&#x6539;&#x914D;&#x7F6E;&#x4E4B;&#x540E;&#xFF0C;&#x9700;&#x8981;&#x542F;&#x52A8;&#x670D;&#x52A1;&#x5373;&#x53EF;&#x751F;&#x6548;&#x3002;</p>
<pre><code class="lang-sh">$ sudo service mesos-master start
</code></pre>
<p>&#x66F4;&#x591A;&#x9009;&#x9879;&#x53EF;&#x4EE5;&#x53C2;&#x8003;&#x540E;&#x9762;&#x7684;&#x914D;&#x7F6E;&#x9879;&#x89E3;&#x6790;&#x7AE0;&#x8282;&#x3002;</p>
<p>&#x4E3B;&#x8282;&#x70B9;&#x670D;&#x52A1;&#x542F;&#x52A8;&#x540E;&#xFF0C;&#x5219;&#x53EF;&#x4EE5;&#x5728;&#x4ECE;&#x8282;&#x70B9;&#x4E0A;&#x542F;&#x52A8; mesos-slave &#x670D;&#x52A1;&#x6765;&#x52A0;&#x5165;&#x4E3B;&#x8282;&#x70B9;&#x7684;&#x7BA1;&#x7406;&#x3002;</p>
<h5 id="&#x4ECE;&#x8282;&#x70B9;">&#x4ECE;&#x8282;&#x70B9;</h5>
<p>&#x4E00;&#x822C;&#x53EA;&#x9700;&#x8981;&#x5173;&#x6CE8; <code>/etc/mesos-slave/</code> &#x76EE;&#x5F55;&#x4E0B;&#x7684;&#x6587;&#x4EF6;&#x3002;&#x9ED8;&#x8BA4;&#x60C5;&#x51B5;&#x4E0B;&#x76EE;&#x5F55;&#x4E0B;&#x4E3A;&#x7A7A;&#x3002;</p>
<p>&#x6587;&#x4EF6;&#x547D;&#x540D;&#x548C;&#x5185;&#x5BB9;&#x4E5F;&#x662F;&#x8DDF;&#x4E3B;&#x8282;&#x70B9;&#x7C7B;&#x4F3C;&#xFF0C;&#x5BF9;&#x5E94;&#x4E8C;&#x8FDB;&#x5236;&#x6587;&#x4EF6;&#x652F;&#x6301;&#x7684;&#x547D;&#x4EE4;&#x884C;&#x53C2;&#x6570;&#x3002;</p>
<p>&#x5EFA;&#x8BAE;&#x5728;&#x4ECE;&#x8282;&#x70B9;&#x4E0A;&#xFF0C;&#x521B;&#x5EFA; <code>/etc/mesos-slave/ip</code> &#x6587;&#x4EF6;&#xFF0C;&#x5728;&#x5176;&#x4E2D;&#x5199;&#x5165;&#x8DDF;&#x4E3B;&#x8282;&#x70B9;&#x901A;&#x4FE1;&#x7684;&#x5730;&#x5740;&#x3002;</p>
<p>&#x4FEE;&#x6539;&#x914D;&#x7F6E;&#x4E4B;&#x540E;&#xFF0C;&#x4E5F;&#x9700;&#x8981;&#x91CD;&#x65B0;&#x542F;&#x52A8;&#x670D;&#x52A1;&#x3002;</p>
<pre><code class="lang-sh">$ sudo service mesos-slave start
</code></pre>
<p>&#x66F4;&#x591A;&#x9009;&#x9879;&#x53EF;&#x4EE5;&#x53C2;&#x8003;&#x540E;&#x9762;&#x7684;&#x914D;&#x7F6E;&#x9879;&#x89E3;&#x6790;&#x7AE0;&#x8282;&#x3002;</p>
<h4 id="marathon">Marathon</h4>
<p>Marathon &#x4F5C;&#x4E3A; Mesos &#x7684;&#x4E00;&#x4E2A;&#x5E94;&#x7528;&#x6846;&#x67B6;&#xFF0C;&#x914D;&#x7F6E;&#x8981;&#x66F4;&#x4E3A;&#x7B80;&#x5355;&#xFF0C;&#x5FC5;&#x9700;&#x7684;&#x914D;&#x7F6E;&#x9879;&#x6709; <code>--master</code> &#x548C; <code>--zk</code>&#x3002;</p>
<p>&#x5B89;&#x88C5;&#x5B8C;&#x6210;&#x540E;&#xFF0C;&#x4F1A;&#x5728; /usr/bin &#x4E0B;&#x591A;&#x4E00;&#x4E2A; marathon shell &#x811A;&#x672C;&#xFF0C;&#x4E3A;&#x542F;&#x52A8; marathon &#x65F6;&#x5019;&#x6267;&#x884C;&#x7684;&#x547D;&#x4EE4;&#x3002;</p>
<p>&#x914D;&#x7F6E;&#x76EE;&#x5F55;&#x4E3A; <code>/etc/marathon/conf</code>&#xFF08;&#x9700;&#x8981;&#x624B;&#x52A8;&#x521B;&#x5EFA;&#xFF09;&#xFF0C;&#x6B64;&#x5916;&#x9ED8;&#x8BA4;&#x914D;&#x7F6E;&#x6587;&#x4EF6;&#x5728; <code>/etc/default/marathon</code>&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x624B;&#x52A8;&#x521B;&#x5EFA;&#x914D;&#x7F6E;&#x76EE;&#x5F55;&#xFF0C;&#x5E76;&#x6DFB;&#x52A0;&#x914D;&#x7F6E;&#x9879;&#xFF08;&#x6587;&#x4EF6;&#x547D;&#x540D;&#x548C;&#x5185;&#x5BB9;&#x8DDF; Mesos &#x98CE;&#x683C;&#x4E00;&#x81F4;&#xFF09;&#xFF0C;&#x8BA9; Marathon &#x80FD;&#x8FDE;&#x63A5;&#x5230;&#x5DF2;&#x521B;&#x5EFA;&#x7684; Mesos &#x96C6;&#x7FA4;&#x4E2D;&#x3002;</p>
<pre><code class="lang-sh">$ sudo mkdir -p /etc/marathon/conf
$ sudo cp /etc/mesos/zk /etc/marathon/conf/master
</code></pre>
<p>&#x540C;&#x65F6;&#xFF0C;&#x8BA9; Marathon &#x4E5F;&#x5C06;&#x81EA;&#x8EAB;&#x7684;&#x72B6;&#x6001;&#x4FE1;&#x606F;&#x4FDD;&#x5B58;&#x5230; ZooKeeper &#x4E2D;&#x3002;&#x521B;&#x5EFA; <code>/etc/marathon/conf/zk</code> &#x6587;&#x4EF6;&#xFF0C;&#x6DFB;&#x52A0; ZooKeeper &#x5730;&#x5740;&#x548C;&#x8DEF;&#x5F84;&#x3002;</p>
<pre><code class="lang-sh">zk://10.0.0.2:2181,10.0.0.2:2181,10.0.0.2:2181/marathon
</code></pre>
<p>&#x542F;&#x52A8; marathon &#x670D;&#x52A1;&#x3002;</p>
<pre><code class="lang-sh">$ sudo service marathon start
</code></pre>
<h3 id="&#x8BBF;&#x95EE;-mesos-&#x56FE;&#x5F62;&#x754C;&#x9762;">&#x8BBF;&#x95EE; Mesos &#x56FE;&#x5F62;&#x754C;&#x9762;</h3>
<p>Mesos &#x81EA;&#x5E26;&#x4E86; Web &#x56FE;&#x5F62;&#x754C;&#x9762;&#xFF0C;&#x53EF;&#x4EE5;&#x65B9;&#x4FBF;&#x7528;&#x6237;&#x67E5;&#x770B;&#x96C6;&#x7FA4;&#x72B6;&#x6001;&#x3002;</p>
<p>&#x7528;&#x6237;&#x5728; Mesos &#x4E3B;&#x8282;&#x70B9;&#x670D;&#x52A1;&#x548C;&#x4ECE;&#x8282;&#x70B9;&#x670D;&#x52A1;&#x90FD;&#x542F;&#x52A8;&#x540E;&#xFF0C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x6D4F;&#x89C8;&#x5668;&#x8BBF;&#x95EE;&#x4E3B;&#x8282;&#x70B9; 5050 &#x7AEF;&#x53E3;&#xFF0C;&#x770B;&#x5230;&#x7C7B;&#x4F3C;&#x5982;&#x4E0B;&#x754C;&#x9762;&#xFF0C;&#x5DF2;&#x7ECF;&#x6709;&#x4E24;&#x4E2A; slave &#x8282;&#x70B9;&#x52A0;&#x5165;&#x4E86;&#x3002;</p>
<p><img src="_images/mesos.png" alt="mesos &#x754C;&#x9762;&#x67E5;&#x770B;&#x52A0;&#x5165;&#x7684; slave &#x8282;&#x70B9;"></p>
<p>&#x901A;&#x8FC7; Slaves &#x6807;&#x7B7E;&#x9875;&#x80FD;&#x770B;&#x5230;&#x52A0;&#x5165;&#x96C6;&#x7FA4;&#x7684;&#x4ECE;&#x8282;&#x70B9;&#x7684;&#x4FE1;&#x606F;&#x3002;</p>
<p>&#x5982;&#x679C;&#x6CA1;&#x6709;&#x542F;&#x52A8; Marathon &#x670D;&#x52A1;&#xFF0C;&#x5728; Frameworks &#x6807;&#x7B7E;&#x9875;&#x4E0B;&#x5C06;&#x770B;&#x4E0D;&#x5230;&#x4EFB;&#x4F55;&#x5185;&#x5BB9;&#x3002;</p>
<h3 id="&#x8BBF;&#x95EE;-marathon-&#x56FE;&#x5F62;&#x754C;&#x9762;">&#x8BBF;&#x95EE; Marathon &#x56FE;&#x5F62;&#x754C;&#x9762;</h3>
<p>Marathon &#x670D;&#x52A1;&#x542F;&#x52A8;&#x6210;&#x529F;&#x540E;&#xFF0C;&#x5728; Mesos &#x7684; web &#x754C;&#x9762;&#x7684; Frameworks &#x6807;&#x7B7E;&#x9875;&#x4E0B;&#x9762;&#x5C06;&#x80FD;&#x770B;&#x5230;&#x540D;&#x79F0;&#x4E3A; marathon &#x7684;&#x6846;&#x67B6;&#x51FA;&#x73B0;&#x3002;</p>
<p>&#x540C;&#x65F6;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x6D4F;&#x89C8;&#x5668;&#x8BBF;&#x95EE; 8080 &#x7AEF;&#x53E3;&#xFF0C;&#x770B;&#x5230; Marathon &#x81EA;&#x5DF1;&#x7684;&#x7BA1;&#x7406;&#x754C;&#x9762;&#x3002;</p>
<p><img src="_images/marathon.png" alt="marathon &#x56FE;&#x5F62;&#x7BA1;&#x7406;&#x754C;&#x9762;"></p>
<p>&#x6B64;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x754C;&#x9762;&#x6216;&#x8005; REST API &#x6765;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5E94;&#x7528;&#xFF0C;Marathon &#x4F1A;&#x4FDD;&#x6301;&#x8BE5;&#x5E94;&#x7528;&#x7684;&#x6301;&#x7EED;&#x8FD0;&#x884C;&#x3002;</p>
<p><img src="_images/marathon_basic0.png" alt="marathon &#x67E5;&#x770B;&#x4EFB;&#x52A1;&#x652F;&#x6301;&#x7684;&#x53C2;&#x6570;"></p>
<p>&#x901A;&#x8FC7;&#x754C;&#x9762;&#x65B9;&#x5F0F;&#x53EF;&#x4EE5;&#x770B;&#x5230;&#x5404;&#x4EFB;&#x52A1;&#x652F;&#x6301;&#x7684;&#x53C2;&#x6570;&#xFF08;&#x5305;&#x62EC;&#x8D44;&#x6E90;&#x3001;&#x547D;&#x4EE4;&#x3001;&#x73AF;&#x5883;&#x53D8;&#x91CF;&#x3001;&#x5065;&#x5EB7;&#x68C0;&#x67E5;&#x7B49;&#xFF09;&#xFF0C;&#x540C;&#x65F6;&#x53EF;&#x4EE5;&#x5F88;&#x5BB9;&#x6613;&#x5730;&#x4FEE;&#x6539;&#x4EFB;&#x52A1;&#x8FD0;&#x884C;&#x5B9E;&#x4F8B;&#x6570;&#x8FDB;&#x884C;&#x6269;&#x5C55;&#xFF0C;&#x975E;&#x5E38;&#x9002;&#x5408;&#x8FDB;&#x884C;&#x6D4B;&#x8BD5;&#x3002;</p>
<p>&#x5982;&#x679C;&#x8981;&#x66F4;&#x81EA;&#x52A8;&#x5316;&#x5730;&#x4F7F;&#x7528; Marathon&#xFF0C;&#x5219;&#x9700;&#x8981;&#x901A;&#x8FC7;&#x5B83;&#x7684; REST API &#x8FDB;&#x884C;&#x64CD;&#x4F5C;&#x3002;</p>
<p>&#x4E00;&#x822C;&#x7684;&#xFF0C;&#x542F;&#x52A8;&#x65B0;&#x4EFB;&#x52A1;&#x9700;&#x8981;&#x5148;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x5B9A;&#x4E49;&#x6A21;&#x677F;&#xFF08;JSON &#x683C;&#x5F0F;&#xFF09;&#xFF0C;&#x7136;&#x540E;&#x53D1;&#x5230;&#x6307;&#x5B9A;&#x7684; API&#x3002;</p>
<p>&#x4F8B;&#x5982;&#xFF0C;&#x793A;&#x4F8B;&#x4EFB;&#x52A1; basic-0 &#x7684;&#x5B9A;&#x4E49;&#x6A21;&#x677F;&#x4E3A;&#xFF1A;</p>
<pre><code class="lang-json">{
    <span class="hljs-string">&quot;id&quot;</span>: <span class="hljs-string">&quot;basic-0&quot;</span>,
    <span class="hljs-string">&quot;cmd&quot;</span>: <span class="hljs-string">&quot;while [ true ] ; do echo &apos;Hello Marathon&apos; ; sleep 5 ; done&quot;</span>,
    <span class="hljs-string">&quot;cpus&quot;</span>: <span class="hljs-number">0.1</span>,
    <span class="hljs-string">&quot;mem&quot;</span>: <span class="hljs-number">10.0</span>,
    <span class="hljs-string">&quot;instances&quot;</span>: <span class="hljs-number">1</span>
}
</code></pre>
<p>&#x8BE5;&#x4EFB;&#x52A1;&#x7533;&#x8BF7;&#x8D44;&#x6E90;&#x4E3A; 0.1 &#x4E2A;&#x5355;&#x6838; CPU &#x8D44;&#x6E90;&#x548C; 10 MB &#x7684;&#x5185;&#x5B58;&#x8D44;&#x6E90;&#xFF0C;&#x5177;&#x4F53;&#x547D;&#x4EE4;&#x4E3A;&#x6BCF;&#x9694;&#x4E94;&#x79D2;&#x949F;&#x7528; shell &#x6253;&#x5370;&#x4E00;&#x53E5; <code>Hello Marathon</code>&#x3002;</p>
<p>&#x53EF;&#x4EE5;&#x901A;&#x8FC7;&#x5982;&#x4E0B;&#x547D;&#x4EE4;&#x53D1;&#x51FA; basic-0 &#x4EFB;&#x52A1;&#x5230; Marathon &#x6846;&#x67B6;&#xFF0C;&#x6846;&#x67B6;&#x4F1A;&#x5206;&#x914D;&#x4EFB;&#x52A1;&#x5230;&#x67D0;&#x4E2A;&#x6EE1;&#x8DB3;&#x6761;&#x4EF6;&#x7684;&#x4ECE;&#x8282;&#x70B9;&#x4E0A;&#xFF0C;&#x6210;&#x529F;&#x4F1A;&#x8FD4;&#x56DE;&#x4E00;&#x4E2A; json &#x5BF9;&#x8C61;&#xFF0C;&#x63CF;&#x8FF0;&#x4EFB;&#x52A1;&#x7684;&#x8BE6;&#x7EC6;&#x4FE1;&#x606F;&#x3002;</p>
<pre><code class="lang-sh">$ curl -X POST http://marathon_host:8080/v2/apps <span class="hljs-_">-d</span> @basic-0.json -H <span class="hljs-string">&quot;Content-type: application/json&quot;</span>
{<span class="hljs-string">&quot;id&quot;</span>:<span class="hljs-string">&quot;/basic-0&quot;</span>,<span class="hljs-string">&quot;cmd&quot;</span>:<span class="hljs-string">&quot;while [ true ] ; do echo &apos;Hello Marathon&apos; ; sleep 5 ; done&quot;</span>,<span class="hljs-string">&quot;args&quot;</span>:null,<span class="hljs-string">&quot;user&quot;</span>:null,<span class="hljs-string">&quot;env&quot;</span>:{},<span class="hljs-string">&quot;instances&quot;</span>:1,<span class="hljs-string">&quot;cpus&quot;</span>:0.1,<span class="hljs-string">&quot;mem&quot;</span>:10,<span class="hljs-string">&quot;disk&quot;</span>:0,<span class="hljs-string">&quot;executor&quot;</span>:<span class="hljs-string">&quot;&quot;</span>,<span class="hljs-string">&quot;constraints&quot;</span>:[],<span class="hljs-string">&quot;uris&quot;</span>:[],<span class="hljs-string">&quot;storeUrls&quot;</span>:[],<span class="hljs-string">&quot;ports&quot;</span>:[0],<span class="hljs-string">&quot;requirePorts&quot;</span>:<span class="hljs-literal">false</span>,<span class="hljs-string">&quot;backoffSeconds&quot;</span>:1,<span class="hljs-string">&quot;backoffFactor&quot;</span>:1.15,<span class="hljs-string">&quot;maxLaunchDelaySeconds&quot;</span>:3600,<span class="hljs-string">&quot;container&quot;</span>:null,<span class="hljs-string">&quot;healthChecks&quot;</span>:[],<span class="hljs-string">&quot;dependencies&quot;</span>:[],<span class="hljs-string">&quot;upgradeStrategy&quot;</span>:{<span class="hljs-string">&quot;minimumHealthCapacity&quot;</span>:1,<span class="hljs-string">&quot;maximumOverCapacity&quot;</span>:1},<span class="hljs-string">&quot;labels&quot;</span>:{},<span class="hljs-string">&quot;acceptedResourceRoles&quot;</span>:null,<span class="hljs-string">&quot;version&quot;</span>:<span class="hljs-string">&quot;2015-12-28T05:33:05.805Z&quot;</span>,<span class="hljs-string">&quot;tasksStaged&quot;</span>:0,<span class="hljs-string">&quot;tasksRunning&quot;</span>:0,<span class="hljs-string">&quot;tasksHealthy&quot;</span>:0,<span class="hljs-string">&quot;tasksUnhealthy&quot;</span>:0,<span class="hljs-string">&quot;deployments&quot;</span>:[{<span class="hljs-string">&quot;id&quot;</span>:<span class="hljs-string">&quot;3ec3fbd5-11e4-479f-bd17-813d33e43e0c&quot;</span>}],<span class="hljs-string">&quot;tasks&quot;</span>:[]}%
</code></pre>
<p>Marathon &#x7684;&#x66F4;&#x591A; REST API &#x53EF;&#x4EE5;&#x53C2;&#x8003;&#x672C;&#x5730;&#x81EA;&#x5E26;&#x7684;&#x6587;&#x6863;&#xFF1A;<code>http://marathon_host:8080/api-console/index.html</code>&#x3002;</p>
<p>&#x6B64;&#x65F6;&#xFF0C;&#x5982;&#x679C;&#x8FD0;&#x884C;&#x4EFB;&#x52A1;&#x7684;&#x4ECE;&#x8282;&#x70B9;&#x51FA;&#x73B0;&#x6545;&#x969C;&#xFF0C;&#x4EFB;&#x52A1;&#x4F1A;&#x81EA;&#x52A8;&#x5728;&#x5176;&#x5B83;&#x53EF;&#x7528;&#x7684;&#x4ECE;&#x8282;&#x70B9;&#x4E0A;&#x542F;&#x52A8;&#x3002;</p>
<p>&#x6B64;&#x5916;&#xFF0C;&#x76EE;&#x524D;&#x4E5F;&#x5DF2;&#x7ECF;&#x652F;&#x6301;&#x57FA;&#x4E8E; Docker &#x5BB9;&#x5668;&#x7684;&#x4EFB;&#x52A1;&#x3002;&#x9700;&#x8981;&#x5148;&#x5728; Mesos slave &#x8282;&#x70B9;&#x4E0A;&#x4E3A; slave &#x670D;&#x52A1;&#x914D;&#x7F6E; <code>--containerizers=docker,mesos</code> &#x53C2;&#x6570;&#x3002;</p>
<p>&#x4F8B;&#x5982;&#x5982;&#x4E0B;&#x9762;&#x7684;&#x793A;&#x4F8B;&#x4EFB;&#x52A1;&#xFF1A;</p>
<pre><code class="lang-json">{
  <span class="hljs-string">&quot;id&quot;</span>: <span class="hljs-string">&quot;basic-3&quot;</span>,
  <span class="hljs-string">&quot;cmd&quot;</span>: <span class="hljs-string">&quot;python3 -m http.server 8080&quot;</span>,
  <span class="hljs-string">&quot;cpus&quot;</span>: <span class="hljs-number">0.5</span>,
  <span class="hljs-string">&quot;mem&quot;</span>: <span class="hljs-number">32.0</span>,
  <span class="hljs-string">&quot;container&quot;</span>: {
      <span class="hljs-string">&quot;type&quot;</span>: <span class="hljs-string">&quot;DOCKER&quot;</span>,
      <span class="hljs-string">&quot;volumes&quot;</span>: [],
      <span class="hljs-string">&quot;docker&quot;</span>: {
        <span class="hljs-string">&quot;image&quot;</span>: <span class="hljs-string">&quot;python:3&quot;</span>,
        <span class="hljs-string">&quot;network&quot;</span>: <span class="hljs-string">&quot;BRIDGE&quot;</span>,
        <span class="hljs-string">&quot;portMappings&quot;</span>: [
          {
            <span class="hljs-string">&quot;containerPort&quot;</span>: <span class="hljs-number">8080</span>,
            <span class="hljs-string">&quot;hostPort&quot;</span>: <span class="hljs-number">31000</span>,
            <span class="hljs-string">&quot;servicePort&quot;</span>: <span class="hljs-number">0</span>,
            <span class="hljs-string">&quot;protocol&quot;</span>: <span class="hljs-string">&quot;tcp&quot;</span>
          }
        ],
        <span class="hljs-string">&quot;privileged&quot;</span>: <span class="hljs-literal">false</span>,
        <span class="hljs-string">&quot;parameters&quot;</span>: [],
        <span class="hljs-string">&quot;forcePullImage&quot;</span>: <span class="hljs-literal">true</span>
      }
  }
}
</code></pre>
<p>&#x8BE5;&#x4EFB;&#x52A1;&#x542F;&#x52A8;&#x4E00;&#x4E2A; <code>python:3</code> &#x5BB9;&#x5668;&#xFF0C;&#x6267;&#x884C; <code>python3 -m http.server 8080</code> &#x547D;&#x4EE4;&#xFF0C;&#x4F5C;&#x4E3A;&#x4E00;&#x4E2A;&#x7B80;&#x5355;&#x7684; web &#x670D;&#x52A1;&#xFF0C;&#x5B9E;&#x9645;&#x7AEF;&#x53E3;&#x4F1A;&#x6620;&#x5C04;&#x5230;&#x5BBF;&#x4E3B;&#x673A;&#x7684; 31000 &#x7AEF;&#x53E3;&#x3002;</p>
<p>&#x6CE8;&#x610F;&#x533A;&#x5206; hostPort &#x548C; servicePort&#xFF0C;&#x524D;&#x8005;&#x4EE3;&#x8868;&#x4EFB;&#x52A1;&#x6620;&#x5C04;&#x5230;&#x7684;&#x672C;&#x5730;&#x53EF;&#x7528;&#x7AEF;&#x53E3;&#xFF08;&#x53EF;&#x7528;&#x8303;&#x56F4;&#x7531; Mesos slave &#x6C47;&#x62A5;&#xFF0C;&#x9ED8;&#x8BA4;&#x4E3A; 31000 ~ 32000&#xFF09;&#xFF1B;&#x540E;&#x8005;&#x4F5C;&#x4E3A;&#x670D;&#x52A1;&#x7BA1;&#x7406;&#x7684;&#x7AEF;&#x53E3;&#xFF0C;&#x53EF;&#x4EE5;&#x88AB;&#x7528;&#x4F5C;&#x4E00;&#x4E9B;&#x670D;&#x52A1;&#x53D1;&#x884C;&#x673A;&#x5236;&#x4F7F;&#x7528;&#x8FDB;&#x884C;&#x8F6C;&#x53D1;&#xFF0C;&#x5728;&#x6574;&#x4E2A; Marathon &#x96C6;&#x7FA4;&#x4E2D;&#x662F;&#x552F;&#x4E00;&#x7684;&#x3002;</p>
<p>&#x4EFB;&#x52A1;&#x6267;&#x884C;&#x540E;&#xFF0C;&#x4E5F;&#x53EF;&#x4EE5;&#x5728;&#x5BF9;&#x5E94; slave &#x8282;&#x70B9;&#x4E0A;&#x901A;&#x8FC7; Docker &#x547D;&#x4EE4;&#x67E5;&#x770B;&#x5BB9;&#x5668;&#x8FD0;&#x884C;&#x60C5;&#x51B5;&#xFF0C;&#x5BB9;&#x5668;&#x5C06;&#x4EE5; <code>mesos-SLAVE_ID</code> &#x5F00;&#x5934;&#x3002;</p>
<pre><code class="lang-sh">$ docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                     NAMES
1226b4ec8d7d        python:3            <span class="hljs-string">&quot;/bin/sh -c &apos;python3 &quot;</span>   3 days ago          Up 3 days           0.0.0.0:10000-&gt;8080/tcp   mesos-06db0fba-49dc-4d28-ad87-6c2d5a020866-S10.b581149e-2c43-46a2-b652-1a0bc10204b3
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="intro.html" class="navigation navigation-prev " aria-label="Previous page: Mesos 简介">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="architecture.html" class="navigation navigation-next " aria-label="Next page: 原理与架构">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"安装与使用","level":"1.30.1.2","depth":3,"next":{"title":"原理与架构","level":"1.30.1.3","depth":3,"path":"mesos/architecture.md","ref":"mesos/architecture.md","articles":[]},"previous":{"title":"Mesos 简介","level":"1.30.1.1","depth":3,"path":"mesos/intro.md","ref":"mesos/intro.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["livereload"],"pluginsConfig":{"livereload":{},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"mesos/installation.md","mtime":"2020-04-12T12:29:28.000Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-04-23T10:39:04.870Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

